/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pe.edu.upc.sigu.modelo.daoImpl;

import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import org.springframework.stereotype.Repository;
import pe.edu.upc.sigu.entities.Carreras;
import pe.edu.upc.sigu.modelo.dao.CarreraDao;

/**
 *
 * @author Usuario2
 */

@Repository(value="carreraDao")
public class CarreraDaoImpl implements CarreraDao {

    private  EntityManager entityManager =null;
    
    @PersistenceContext
    public void setEntityManager(EntityManager entityManager){
        this.entityManager = entityManager;
    }

    @Override
    public List<Carreras> getCarrerasList() {

         String sql = "SELECT c FROM  Carreras c";
         Query query = entityManager.createQuery(sql);
        return query.getResultList();

    }




}
